package com.imy.luascript.app.ui.preview;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.widget.ImageView;

import com.imy.common.helper.ParamsHelper;
import com.imy.luascript.R;
import com.imy.luascript.base.activity.BaseViewActivity;
import com.imy.luascript.utils.ToolBarBuilder;
import com.imy.luascript.viewmodel.BaseViewModel;

import java.io.File;

import butterknife.BindView;
import butterknife.ButterKnife;

public class ImagePreviewActivity extends BaseViewActivity {
    @BindView(R.id.preview_image_iv)
    ImageView previewImageIv;

    public static void start(Context context, String path) {
        Intent intent = new Intent(context, ImagePreviewActivity.class);
        intent.putExtra(ParamsHelper.PATH, path);
        context.startActivity(intent);
    }



    @Override
    protected BaseViewModel getViewModel() {
        return null;
    }

    @Override
    protected void initView() {
        setToolbarTitle("预览");
        String path = getIntent().getStringExtra(ParamsHelper.PATH);
        Bitmap bitmap = BitmapFactory.decodeFile(path);
        previewImageIv.setImageBitmap(bitmap);
    }

    @Override
    protected int getLayoutID() {
        return R.layout.activity_image_preview;
    }

}
